Machine vision inspection system and method for obtaining an image with an extended depth of field

ABSTRACT

A method for providing an extended depth of field (EDOF) image includes: Periodically modulating an imaging system focus position at a high frequency; using an image exposure comprising discrete image exposure increments acquired at discrete focus positions during an image integration time comprising a plurality of modulation periods of the focus position; and using strobe operations having controlled timings configured to define a set of evenly spaced focus positions for the image exposure increments. The timings are configured so that adjacent focus positions in the set are acquired at times that are separated by at least one reversal of the direction of change of the focus position during its periodic modulation. This solves practical timing problems that may otherwise prevent obtaining closely spaced discrete image exposure increments during high frequency focus modulation. Deconvolution operations may be used to improve clarity in the resulting EDOF image.

FIELD

The invention relates generally to machine vision inspection systems, and more particularly to extended depth-of-field imaging operations.

BACKGROUND

Precision machine vision inspection systems (or “vision systems” for short) are used to obtain precise dimensional measurements of objects and to inspect various other object characteristics. Such systems may include a computer, a camera and optical system, and a precision stage that moves to allow workpiece traversal and inspection. One exemplary prior art system, characterized as a general-purpose “off-line” precision vision system, is the QUICK VISION® series of PC-based vision systems and QVPAK® software available from Mitutoyo America Corporation (MAC), located in Aurora, Ill. The features and operation of the QUICK VISION® series of vision systems and the QVPAK® software are generally described, for example, in the QVPAK 3D CNC Vision Measuring Machine User's Guide, published January 2003, and the QVPAK 3D CNC Vision Measuring Machine Operation Guide, published September 1996, each of which is hereby incorporated by reference in their entirety. This type of system uses a microscope-type optical system and moves the stage so as to provide inspection images of either small or relatively large workpieces at various magnifications.

General-purpose precision machine vision inspection systems are generally programmable to provide automated video inspection. Such systems typically include GUI features and predefined image analysis “video tools” such that operation and programming can be performed by “non-expert” operators. For example, U.S. Pat. No. 6,542,180, which is incorporated herein by reference in its entirety, teaches a vision system that uses automated video inspection including the use of various video tools.

The machine control instructions including the specific inspection event sequence (i.e., how to acquire each image and how to analyze/inspect each acquired image) are generally stored as a “part program” or “workpiece program” that is specific to the particular workpiece configuration. For example, a part program defines how to acquire each image, such as how to position the camera relative to the workpiece, at what lighting level, at what magnification level, etc. Further, the part program defines how to analyze/inspect an acquired image, for example, by using one or more video tools such as autofocus video tools.

Video tools (or “tools” for short) and other graphical user interface features may be used manually to accomplish manual inspection and/or machine control operations (in “manual mode”). Their set-up parameters and operation can also be recorded during learn mode, in order to create automatic inspection programs, or “part programs.” Video tools may include, for example, edge-/boundary-detection tools, autofocus tools, shape- or pattern-matching tools, dimension-measuring tools, and the like.

In some applications, it is desirable to operate an imaging system of a machine vision inspection system to collect an image with an extended depth of field (EDOF), such that the depth of field is larger than that provided by the optical imaging system at a single focus position. Various methods are known for collecting an image with an extended depth of field. One such method is to collect an image “stack,” consisting of a plurality of congruent or aligned images focused at different distances throughout a focus range. A mosaic image of the field of view is constructed from the image stack, wherein each portion of the field of view is extracted from the particular image that shows that portion with the best focus. However, this method is relatively slow. As another example, Nagahara et al. (“Flexible Depth of Field Photography.” Proceedings of the European Conference on Computer Vision, October 2008) discloses a method wherein a single image is exposed along a plurality of focus distances during its exposure time. This image is relatively blurry, but contains image information acquired over the plurality of focus distances. It is deconvolved using a known or predetermined blur kernel to obtain a relatively clear image with an extended depth of field. In the method described in Nagahara, the focal distance is altered by translating the image detector along an optical axis of an imaging system. As a result, different focal planes are focused on the detector at different times during exposure. However, such a method is relatively slow and mechanically complex. Furthermore, altering the detector position may have detrimental effects on repeatability and/or accuracy when it is used for acquiring fixed focus inspection images, which must be used for precision measurements (e.g., for accuracies on the order of a few micrometers) and the like. An improved method for providing an extended depth of field (EDOF) image is desirable, which may be performed at high speed without relying on mechanical translation of optical components.

SUMMARY

A typical high speed variable focus lens may modulate a focus position in a sinusoidal manner (as opposed to linear), which will generally not provide an even or “balanced” exposure throughout an entire cycle of focus position modulation which may be used to acquire an extended depth of field (EDOF) image. In contrast, in various applications using a high speed variable focus lens it is desirable to provide an even or “balanced” exposure throughout an entire cycle of focus position modulation which may be used to acquire an extended depth of field (EDOF) image.

A method is disclosed for operating an imaging system of a machine vision inspection system in order to provide at least one EDOF image that has a larger depth of field than the imaging system in a single focal position. In various implementations, the method includes exposing a preliminary EDOF image using an image exposure comprising a plurality of discrete image exposure increments, according to principles disclosed herein.

In various implementations, the method may include placing a workpiece in a field of view of the machine vision inspection system. A focus position of variable focus imaging system is periodically modulated, preferably without macroscopically adjusting the spacing between elements in the imaging system, wherein the focus position is periodically modulated over a plurality of focus positions along a focus axis direction in a focus range including a surface height of the workpiece, at a modulation frequency of at least 3 kHz.

In various implementations, a preliminary EDOF image is exposed using an image exposure comprising a plurality of discrete image exposure increments acquired at respective discrete focus positions during an image integration time comprising a plurality of periods of the periodically modulated focus position, wherein:

-   -   the plurality of discrete image exposure increments are each         determined by a respective instance of an illumination source         strobe operation, or a camera shutter strobe operation, that has         a respective controlled timing that defines the discrete focus         position of the corresponding discrete image exposure increment;     -   the respective controlled timings are distributed over the         plurality of periods of the periodically modulated focus         position, and are configured to provide a set of discrete focus         positions which are approximately evenly spaced along the focus         axis direction; and     -   the respective controlled timings are furthermore configured so         that for a plurality of adjacent pairs of discrete focus         positions in the set, when a first controlled timing provides a         first discrete focus position set of the adjacent pair, a second         controlled timing that provides a second discrete focus position         of the adjacent pair is controlled to have a delay relative to         the first controlled timing such that the second controlled         timing is controlled to occur after N reversals of the direction         of change of the focus position during its periodic modulation         following the first controlled timing, where N is at least 1.

In various implementations, the preliminary EDOF image may be processed to remove blurred image contributions occurring in the focus range during the image integration time to provide an extended depth of field (EDOF) image that is substantially focused throughout a larger depth of field than the imaging system provides at a single focal position. In some implementations, such processing may include performing deconvolution operations using a blur kernel that characterizes the imaging system throughout its focus range (e.g., an integrated point spread function).

In some implementations, each discrete image exposure increment comprises a combination of an increment exposure duration and an illumination intensity used during the increment exposure duration such that each discrete image exposure increment provides nominally equal exposure energy to the preliminary EDOF image. In some implementations, the increment exposure durations corresponding to different focus positions are adjusted such that approximately the same amount of focus position change occurs during each of the discrete image exposure increments.

In some implementations disclosed herein a continuous (including partially continuous) EDOF image exposure may be used. However, one drawback of such methods may be that the associated EDOF image exposure may not be uniform throughout the focus range, which is detrimental in a number of implementations. An alternative method emphasized above in this summary includes using a plurality of discrete image exposure increments to acquire a preliminary EDOF image in a focus range of a fast variable focus lens (or imaging system), as outlined above. Such a method of EDOF image exposure may be more desirable in that it may be a more adaptable, accurate, and/or robust method in various implementations.

It should be appreciated that when using such a method in conjunction with a very high speed periodically modulated variable focus lens (e.g., a TAG lens), that the focus position may change so quickly (as an inherent feature of the variable focus lens) that significant timing, control, and “exposure amount” problems may arise in practical systems. In order to provide a practical solution to such problems, in various implementations disclosed herein, the discrete image exposure increments that are used as constituents of an EDOF image exposure are acquired over a plurality of the periodic focus modulations, using a controlled timing configured according to certain principles outlined above, and disclosed in greater detail and variety below.

BRIEF DESCRIPTION OF THE DRAWINGS

The foregoing aspects and many of the attendant advantages of this invention will become more readily appreciated as the same become better understood by reference to the following detailed description, when taken in conjunction with the accompanying drawings, wherein:

FIG. 1 is a diagram showing various typical components of a general-purpose precision machine vision inspection system;

FIG. 2 is a block diagram of a control system portion and a vision components portion of a machine vision inspection system similar to that of FIG. 1 and including features disclosed herein;

FIG. 3 shows a schematic diagram of a first embodiment of an EDOF imaging system that may be adapted to a machine vision inspection system and operated according to the principles disclosed herein;

FIG. 4 shows an exemplary timing diagram for a focal height during an image exposure as may be used in one embodiment of an EDOF imaging system (e.g., the imaging system of FIG. 3) according to principles disclosed herein;

FIG. 5 shows a schematic diagram of a second embodiment of an EDOF imaging system that may be adapted to a machine vision inspection system and operated according to the principles disclosed herein;

FIG. 6A is a graph characterizing a first embodiment of an optical filter which may be used at a Fourier plane of an imaging system, in order to perform optical deconvolution of an image from an EDOF imaging system and provide a relatively clear EDOF image in real time;

FIG. 6B is a graph characterizing a second embodiment of an optical filter which may be used at a Fourier plane of an imaging system;

FIG. 7 is a flow diagram showing one embodiment of a method for operating an imaging system of a machine vision inspection system in order to perform computational deconvolution of a preliminary image from an EDOF imaging system and provide a relatively clear EDOF image approximately in real time;

FIGS. 8A-8C show exemplary timing diagrams illustrating various aspects of three different image exposure implementations suitable for an EDOF imaging system (e.g., the imaging system of FIG. 3), including the use of discrete image exposure increments, according to principles disclosed herein.

FIG. 9 shows a timing diagram including certain details of one exemplary implementation of a controlled timing configuration that may be used to define a discrete focus position and certain other characteristics associated with corresponding discrete image exposure increment.

FIG. 10 is a flow diagram showing one embodiment of a method for operating an imaging system (e.g., in an inspection system) in order to provide at least one EDOF image that has a larger depth of field than the imaging system in a single focal position, and including the use of discrete image exposure increments, according to principles disclosed herein.

DETAILED DESCRIPTION

FIG. 1 is a block diagram of one exemplary machine vision inspection system 10 usable in accordance with methods described herein. The machine vision inspection system 10 includes a vision measuring machine 12 that is operably connected to exchange data and control signals with a controlling computer system 14. The controlling computer system 14 is further operably connected to exchange data and control signals with a monitor or display 16, a printer 18, a joystick 22, a keyboard 24, and a mouse 26. The monitor or display 16 may display a user interface suitable for controlling and/or programming the operations of the machine vision inspection system 10. It will be appreciated that in various embodiments, a touchscreen tablet or the like may be substituted for and/or redundantly provide the functions of any or all of the computer system 14, the display 16, the joystick 22, the keyboard 24, and the mouse 26.

Those skilled in the art will appreciate that the controlling computer system 14 may generally consist of any computing system or device. Suitable computing systems or devices may include personal computers, server computers, minicomputers, mainframe computers, distributed computing environments that include any of the foregoing, and the like. Such computing systems or devices may include one or more processors that execute software to perform the functions described herein. Processors include programmable general-purpose or special-purpose microprocessors, programmable controllers, application-specific integrated circuits (ASICs), programmable logic devices (PLDs), or the like, or a combination of such devices. Software may be stored in memory, such as random-access memory (RAM), read-only memory (ROM), flash memory, or the like, or a combination of such components. Software may also be stored in one or more storage devices, such as optical-based disks, flash memory devices, or any other type of non-volatile storage medium for storing data. Software may include one or more program modules that include routines, programs, objects, components, data structures, and so on that perform particular tasks or implement particular abstract data types. In distributed computing environments, the functionality of the program modules may be combined or distributed across multiple computing systems or devices and accessed via service calls, either in a wired or wireless configuration.

The vision measuring machine 12 includes a moveable workpiece stage 32 and an optical imaging system 34 that may include a zoom lens or interchangeable lenses. The zoom lens or interchangeable lenses generally provide various magnifications for the images provided by the optical imaging system 34. The machine vision inspection system 10 is also described in commonly assigned U.S. Pat. Nos. 7,454,053; 7,324,682; 8,111,905; and 8,111,938, each of which is incorporated herein by reference in its entirety.

FIG. 2 is a block diagram of a control system portion 120 and a vision components portion 200 of a machine vision inspection system 100 similar to the machine vision inspection system of FIG. 1, and including features as described herein. As will be described in more detail below, the control system portion 120 is utilized to control the vision components portion 200. The vision components portion 200 includes an optical assembly portion 205, light sources 220, 230, and 240, and a workpiece stage 210 having a central transparent portion 212. The workpiece stage 210 is controllably movable along X and Y axes that lie in a plane that is generally parallel to the surface of the stage where a workpiece 20 may be positioned. The optical assembly portion 205 includes a camera system 260, an interchangeable objective lens 250, and may include a turret lens assembly 280 having lenses 286 and 288. Alternatively to the turret lens assembly, a fixed or manually interchangeable magnification-altering lens, or a zoom lens configuration, or the like, may be included.

The optical assembly portion 205 is controllably movable along a Z axis that is generally orthogonal to the X and Y axes by using a controllable motor 294 that drives an actuator to move the optical assembly portion 205 along the Z axis to change the focus of the image of the workpiece 20. The controllable motor 294 is connected to an input/output interface 130 via a signal line 296.

A workpiece 20, or a tray or fixture holding a plurality of workpieces 20, which is to be imaged using the machine vision inspection system 100, is placed on the workpiece stage 210. The workpiece stage 210 may be controlled to move relative to the optical assembly portion 205, such that the interchangeable objective lens 250 moves between locations on a workpiece 20, and/or among a plurality of workpieces 20. One or more of a stage light 220, a coaxial light 230, and a surface light 240 (e.g., a ring light) (collectively light sources) may emit source light 222, 232, and/or 242, respectively, to illuminate the workpiece or workpieces 20. The light source 230 may emit light 232 along a path including a mirror 290. The source light is reflected or transmitted as workpiece light 255, and the workpiece light used for imaging passes through the interchangeable objective lens 250 and the turret lens assembly 280 and is gathered by the camera system 260. The image of the workpiece(s) 20, captured by the camera system 260, is output on a signal line 262 to the control system portion 120. The light sources 220, 230, and 240 may be connected to the control system portion 120 through signal lines or busses 221, 231, and 241, respectively. To alter the image magnification, the control system portion 120 may rotate the turret lens assembly 280 along axis 284 to select a turret lens through a signal line or bus 281.

As shown in FIG. 2, in various exemplary embodiments, the control system portion 120 includes a controller 125, the input/output interface 130, a memory 140, a workpiece program generator and executor 170, and a power supply portion 190. Each of these components, as well as the additional components described below, may be interconnected by one or more data/control busses and/or application programming interfaces, or by direct connections between the various elements.

The input/output interface 130 includes an imaging control interface 131, a motion control interface 132, a lighting control interface 133, and a lens control interface 134. The imaging control interface 131 may include an extended depth of field (EDOF) mode 131 e, which a user may select to collect at least one image of a workpiece with a depth of field that is greater than what may be provided by the vision components portion 200 when focused at a single focus position. The lens control interface 134 may comprise an EDOF lens controller including a lens focus driving circuit and/or routine, or the like. The operations and components associated with an extended depth of field mode and an EDOF lens control interface and/or controller are described further below with reference to FIGS. 3-7. The motion control interface 132 may include a position control element 132 a, and a speed/acceleration control element 132 b although such elements may be merged and/or indistinguishable. The lighting control interface 133 includes lighting control elements 133 a, 133 n, and 133 fl that control, for example, the selection, power, on/off switch, and strobe pulse timing, if applicable, for the various corresponding light sources of the machine vision inspection system 100.

The memory 140 may include an image file memory portion 141, an edge-detection memory portion 140 ed, a workpiece program memory portion 142 that may include one or more part programs, or the like, and a video tool portion 143. The video tool portion 143 includes video tool portion 143 a and other video tool portions (e.g., 143 n) that determine the GUI, image-processing operation, etc., for each of the corresponding video tools, and a region of interest (ROI) generator 143 roi that supports automatic, semi-automatic, and/or manual operations that define various ROIs that are operable in various video tools included in the video tool portion 143. The video tool portion also includes an autofocus video tool 143 af that determines the GUI, image-processing operation, etc., for focus height measurement operations. In the context of this disclosure, and as known by one of ordinary skill in the art, the term “video tool” generally refers to a relatively complex set of automatic or programmed operations that a machine vision user can implement through a relatively simple user interface (e.g., a graphical user interface, editable parameter windows, menus, and the like), without creating the step-by-step sequence of operations included in the video tool or resorting to a generalized text-based programming language, or the like. For example, a video tool may include a complex pre-programmed set of image-processing operations and computations that are applied and customized in a particular instance by adjusting a few variables or parameters that govern the operations and computations. In addition to the underlying operations and computations, the video tool comprises the user interface that allows the user to adjust those parameters for a particular instance of the video tool. For example, many machine vision video tools allow a user to configure a graphical region of interest (ROI) indicator through simple “handle dragging” operations using a mouse, in order to define the location parameters of a subset of an image that is to be analyzed by the image-processing operations of a particular instance of a video tool. It should be noted that the visible user interface features are sometimes referred to as the video tool with the underlying operations being included implicitly.

The signal lines or busses 221, 231, and 241 of the stage light 220, the coaxial lights 230 and 230′, and the surface light 240, respectively, are all connected to the input/output interface 130. The signal line 262 from the camera system 260 and the signal line 296 from the controllable motor 294 are connected to the input/output interface 130. In addition to carrying image data, the signal line 262 may carry a signal from the controller 125 that initiates image acquisition.

One or more display devices 136 (e.g., the display 16 of FIG. 1) and one or more input devices 138 (e.g., the joystick 22, keyboard 24, and mouse 26 of FIG. 1) can also be connected to the input/output interface 130. The display devices 136 and input devices 138 can be used to display a user interface that may include various graphical user interface (GUI) features that are usable to perform inspection operations, and/or to create and/or modify part programs, to view the images captured by the camera system 260, and/or to directly control the vision components portion 200. The display devices 136 may display user interface features associated with the autofocus video tool 143 af.

In various exemplary embodiments, when a user utilizes the machine vision inspection system 100 to create a part program for the workpiece 20, the user generates part program instructions by operating the machine vision inspection system 100 in a learn mode to provide a desired image-acquisition training sequence. For example, a training sequence may comprise positioning a particular workpiece feature of a representative workpiece in the field of view (FOV), setting light levels, focusing or autofocusing, acquiring an image, and providing an inspection training sequence applied to the image (e.g., using an instance of one of the video tools on that workpiece feature). The learn mode operates such that the sequence(s) are captured or recorded and converted to corresponding part program instructions. These instructions, when the part program is executed, will cause the machine vision inspection system to reproduce the trained image acquisition and cause inspection operations to automatically inspect that particular workpiece feature (that is the corresponding feature in the corresponding location) on a run mode workpiece, or workpieces, which matches the representative workpiece used when creating the part program. The systems and methods disclosed herein are particularly useful during such learn mode and/or manual operations, in that a user may see an EDOF video image in real time while navigating a workpiece for visual inspection and/or workpiece program creation. The user need not continually refocus high-magnification images depending on the height of various microscopic features on the workpiece, which can be tedious and time-consuming, especially at high magnifications.

FIG. 3 shows a schematic diagram of a first embodiment of an EDOF imaging system 300 that may be adapted to a machine vision inspection system and operated according to the principles disclosed herein. The imaging system 300 is configurable to provide at least one image of a workpiece that has a larger depth of field than the imaging system in a single focal position (e.g., 10-20 times larger, or more, in various embodiments). The imaging system 300 comprises a light source 330 that is configurable to illuminate a workpiece in a field of view of the imaging system 300, an objective lens 350, a relay lens 351, a relay lens 352, a variable focal length lens 370, a tube lens 386, and a camera system 360.

In operation, the light source 330 is configurable to emit source light 332 along a path including a mirror 390 to a surface of a workpiece 320, the objective lens 350 receives workpiece light 332 including workpiece light that is focused at a focus position FP proximate to the workpiece 320, and outputs the workpiece light 355 to the relay lens 351. The relay lens 351 receives the workpiece light 355 and outputs it to the relay lens 352. The relay lens 352 receives the workpiece light 355 and outputs it to the variable focal length lens 370. Together, the relay lens 351 and the relay lens 352 provide a 4 f optical relay between the objective lens 350 and the variable focal length lens 370 in order to provide constant magnification for each Z height of the workpiece 320 and/or focus position FP. The variable focal length lens 370 receives the workpiece light 355 and outputs it to the tube lens 386. The variable focal length lens 370 is electronically controllable to vary the focus position FP of the imaging system during one or more image exposures. The focus position FP may be moved within a range R bound by a focus position FP1 and a focus position FP2. It should be appreciated that in some embodiments, the range R may be selected by a user, e.g., in the EDOF mode 131 e of the imaging control interface 131.

In various embodiments, a machine vision inspection system comprises a control system (e.g., the control system portion 120) that is configurable to control the variable focal length lens 370 to periodically modulate a focus position of the imaging system 300. In some embodiments, the variable focal length lens 370 may very rapidly adjust or modulate the focus position (e.g., periodically, at a rate of at least 300 Hz, or 3 kHz, or much higher). In some embodiments, the range R may be as large as 10 mm (for a 1X objective lens 350). In various embodiments, the variable focal length lens 370 is advantageously chosen such that it does not require any macroscopic mechanical adjustments imaging system and/or adjustment of the distance between the objective lens 350 and the workpiece 320 in order to change the focus position FP. In such case, the EDOF image may be provided at a high rate, and furthermore there are no macroscopic adjustment elements nor associated positioning non-repeatability to degrade accuracy when the same imaging system is used for acquiring fixed focus inspection images, which must be used for precision measurements (e.g., for accuracies on the order of a few micrometers) and the like. For example, in some embodiments it is desirable to use the EDOF image as a display image for a user, and later terminate the periodic modulating of the focus position (e.g., using the previously described EDOF mode control element 131 e, or automatic termination based on an active measurement operation, or the like) to provide a fixed focus position for the imaging system. Then the system may be used to expose a measurement image of a particular feature using the imaging system with the fixed focus position; and that stable high-resolution measurement image may be processed to provide an accurate measurement of the workpiece.

In some embodiments, the variable focal length lens 370 is a tunable acoustic gradient index of refraction lens. A tunable acoustic gradient index of refraction lens is a high-speed variable focal length lens that uses sound waves in a fluid medium to modulate a focus position and may periodically sweep a range of focal lengths at a frequency of several hundred kHz. Such a lens may be understood by the teachings of the article, “High-speed varifocal imaging with a tunable acoustic gradient index of refraction lens” (Optics Letters, Vol. 33, No. 18, Sep. 15, 2008), which is hereby incorporated by reference in its entirety. Tunable acoustic gradient index lenses and related controllable signal generators are available, for example, from TAG Optics, Inc., of Princeton, N.J. The SR38 series lenses, for example, are capable of modulation up to 1.0 MHz.

The variable focal length lens 370 may be driven by an EDOF lens controller 374, which may generate a signal to control the variable focal length lens 370. In one embodiment, the EDOF lens controller 374 may be a commercial controllable signal generators such as that referred to above. In some embodiments, the EDOF lens controller 374 may be configured or controlled by a user and/or an operating program through the imaging control interface 131 and/or a user interface of the EDOF mode 131 e and/or the lens control interface 134, outlined previously with reference to FIG. 2. In some embodiments, the variable focal length lens 370 may be driven using a periodic signal such that the focus position FP is modulated sinusoidally over time, at a high frequency. For example, in some exemplary embodiments, a tunable acoustic gradient index of refraction lens may be configured for focal scanning rates as high as 400 kHz, although it should be appreciated that slower focus position adjustments and/or modulation frequencies may be desirable in various embodiments and/or applications. For example, in various embodiments a periodic modulation of 300 Hz, or 3 kHz, or the like may be used. In embodiments where such slower focus position adjustments are used, the variable focal length lens 370 may comprise controllable fluid lens, or the like.

The embodiment of an EDOF imaging system shown in FIG. 3 is usable when an EDOF imaging system and associated signal processing is configured to perform computational deconvolution of a preliminary image from an EDOF imaging system and provide a relatively clear EDOF image approximately in real time. For example, a control system (e.g., the control system portion 120 shown in FIG. 2) is configured to collect a first preliminary image during the course of at least one sweep of the modulated focus position throughout an EDOF focus range during the image exposure, and process the first preliminary image, which may be blurry, to determine a relatively clear image. In one embodiment, the preliminary image may be processed or deconvolved using a known or predetermined point spread function (PSF) corresponding to the focus range of the preliminary image. A point spread function P(FP) characterizes a blur circle, i.e., a circular image of a point light source at a given distance from an imaging system as a function of a radius r of the blur circle and the focus position FP. A point spread function may be determined experimentally for an imaging system (e.g., the imaging system 300) or it may be estimated using point spread functions modeled on functions such as a pill box or a Gaussian curve, or using basic diffraction principles, e.g., Fourier optics, according to known methods. Such point spread functions at various focus distances within a focus range may be weighted according to their expected exposure contributions or applicability. For example, when the focus distance moves during an exposure, each focus distance will contribute to an image exposure for a corresponding time period within that exposure, and a point spread function corresponding to that distance may be weighted accordingly. Such weighted point spread function contributions may be summed or integrated over an expected focus range R. Alternatively, when the focus distance change is a known function of time, such point spread function contributions may be integrated over a period of time corresponding to a sweep of the expected focus range R, analogous to the approach indicated with reference to EQUATION 3 below.

For an imaging system with a modulated focus position, an integrated point spread function h which follows the relation: h=∫ ₀ ^(T) P(FP(t))dt  Eq. 1 where P(FP(t)) is a point spread function and FP(t) is the time-dependent focal position. A focus position of an imaging system of a machine vision inspection system may be modulated as a function of time t, over a total integration time T, corresponding to an image exposure or integration time of the first preliminary image.

Deconvolution of the first preliminary image may be understood as an inverse operation that deconvolves a high depth of field image exposed over a range of focus positions having respective durations in the exposure, from an integrated point spread function h, which in some applications may be referred to as a “blur function.” The first preliminary image may be represented as a two-dimensional function g(x,y) which is a convolution of an extended depth of field image f(x,y) (corresponding to an image array with dimensions m×n) with the integrated point spread function h by the equation: g(x,y)=f*h=Σ _(m)Σ_(n) f(m,n)h(x−m,y−n)  Eq. 2 In the frequency domain, this convolution may be represented by the product of the Fourier transforms off and h, represented as F and H: G=F·H  Eq. 3 The Fourier transforms of f and h may be determined efficiently using a fast Fourier transform (FFT) algorithm. The EDOF image (in the frequency domain) may be determined by processing the image G (i.e., multiplying it) by an inverse of H denoted here as H_(r). The inverse H_(r) may be computed by several known methods. For example, a simple pseudo inverse of H may be determined by the equation:

$\begin{matrix} {H_{r} = \frac{H^{*}}{{H}^{2} + k}} & {{Eq}.\mspace{14mu} 4} \end{matrix}$ where H* is the complex conjugate of the H, and k is a real number chosen empirically based on characteristics of the imaging system 300. In one exemplary embodiment, k is 0.0001. Finally, the extended depth of field image f may be computed as:

$\begin{matrix} {{f\left( {x,y} \right)} = {{g*h_{r}} = {{\mathcal{F}^{- 1}\left( {G \cdot H_{r}} \right)} = {\mathcal{F}^{- 1}\left\{ {G \cdot \frac{H^{*}}{{H}^{2} + k}} \right\}}}}} & {{Eq}.\mspace{14mu} 5} \end{matrix}$ A more robust alternative to the pseudo inverse may be computed according to a Wiener Deconvolution or a Lucy-Richardson iterative algorithm, which are described in Digital Image Processing by Kenneth R. Castleman (Prentice-Hall, Inc., 1996). Additionally, processing the image may comprise block-based denoising.

In a different embodiment, as described in greater detail below with respect to FIGS. 5 and 6, a deconvolution may be performed optically using a passive optical filter placed in a Fourier plane of an EDOF imaging system according to basic methods of Fourier optics, in order to provide a relatively clear EDOF image in real time.

In exemplary embodiments, the imaging system 300 may provide a first preliminary image, which is a blurred image including information acquired throughout a desired focus range during its exposure. The first preliminary image may then be computationally processed as outlined above to provide an extended depth of field image that comprises a depth of field that is larger than the imaging system 300 may provide at a single focal position (e.g., 100 times larger). For example, at a single focal position, the depth of field may be 90 μm and an extended depth of field image provided using the same embodiment of the imaging system 300 may be as large as 9 mm.

FIG. 4 shows an exemplary timing diagram 400 for a focal height during an image exposure as may be used in one embodiment of an EDOF imaging system (e.g., the imaging system 300) according to principles disclosed herein. The timing diagram 400 additionally shows exposure times of a camera of the imaging system. Generally speaking, EDOF image exposures, also referred to as frame exposures in the following description, may be performed by the imaging system over at least one sweep of the modulation of the focal height of the imaging system over a desired focus range during the exposure. In the particular example shown in the timing diagram 400, a frame exposure is performed corresponding to at least one cycle of a periodic modulation of the focal height of the imaging system over a desired focus range. High-speed periodic modulation is conveniently performed using a tunable acoustic gradient index of refraction lens. More specifically, in one embodiment, the following steps reflected in FIG. 4 are repeated at least one time to provide an EDOF image that is substantially focused throughout a larger depth of field than the imaging system provides at a single focal position:

-   -   periodically modulating a focus position (focal plane) of the         imaging system over a plurality of focus positions along a focus         axis direction without macroscopically adjusting the spacing         between elements in the imaging system, the focus position         periodically modulated in a focus range including a surface         height of the workpiece at a frequency of at least 300 Hz;     -   exposing a first preliminary image during an image integration         time while modulating the focus position in the focus range; and     -   processing the first preliminary image to remove blurred image         contributions occurring during the image integration time to         provide an EDOF image that is substantially focused throughout a         larger depth of field than the imaging system provides at a         single focal position.

It will be understood that in the description immediately above, when the blurred image contributions are computationally removed, the first preliminary image may be a blurred image that initially includes the blurred image contributions. The first preliminary image in this case comprises detected and/or recorded image data. Processing the first preliminary image to remove the blurred image contributions comprises computational processing to the first preliminary image data, to provide an EDOF image (a second or modified image) that is substantially focused throughout a larger depth of field than the imaging system provides at a single focal position. Thus, the first preliminary image and the provided EDOF image comprise different images and/or image data in this embodiment.

In contrast, when the blurred image contributions are removed using an optical filter and passive Fourier image-processing methods, the first preliminary image and the EDOF image occur simultaneously, and the first preliminary image need not be a detected or recorded image. Processing the first preliminary image to remove the blurred image contributions comprises passive optical processing to the first preliminary image light that is input to the EDOF imaging system, to provide an EDOF image at the output or detector of the EDOF imaging system that is substantially focused throughout a larger depth of field than the imaging system provides at a single focal position. Thus, it may be considered in such an embodiment that the first preliminary image is optically processed during its passage through the EDOF imaging system and prior to detection at the camera or detector of the EDOF imaging system, such that the provided EDOF image is the only detected or recorded image in such an embodiment.

Control for modulation of the focus position, according to any of the methods outlined herein and/or as illustrated in FIG. 4, may be accomplished as outlined with reference to the EDOF mode element 130 e and the lens control interface 134 shown in FIG. 2, and/or the EDOF lens controllers 374 and 574 shown in FIG. 3 and FIG. 5, respectively.

Because an EDOF imaging system configured according to the principles disclosed herein offers high speed extended depth-of-field imaging, such an imaging system may be utilized to repetitively collect extended depth-of-field images at a high rate, e.g., for video imaging at 30 frames per second or higher, and the plurality of extended depth-of-field images may be displayed as real-time video frames.

In some embodiments it is possible to make an adjustment to a control signal component related to the nominal center of the range R of the periodic modulation in response to a user input (e.g., using a user interface feature of the EDOF mode element 131 e), such that the periodic modulation takes place about a desired nominal center of the range. In some embodiments, such an adjustment may even be controlled to vary automatically during an image exposure, to further extend a focus range beyond that achieved by a single periodic modulation, for example.

It should be appreciated that while the timing diagram shows 7 periods of the modulation of the focal height for each frame exposure, for purposes of illustration, in various embodiments, a machine vision inspection system configured according to the principles disclosed herein may comprise an imaging system that modulates the focal height over a much greater number of periods per frame exposure. For example, an exemplary imaging system may collect video images at 30 frames per second and may modulate the focus height at a rate of 30 kHz, which therefore provides 1,000 periods of focus height modulation per frame exposure. One advantage of such a configuration is that the timing relationship between the frame exposure in the periodic modulation is not critical. For example, Equation 1 shows that an integrated point spread function used to remove blurred image contributions depends on the focal position as a function of time throughout an image exposure. If the assumed integrated point spread function does not match the actual focal position as a function of time throughout the image exposure, then the blurred image contributions will not be treated in an ideal manner. If the assumed integrated point spread function is based on a full periodic modulation of the focus throughout the focus range, and only a single period (or a few periods) of a periodic focus modulation is used during an image exposure then, if the exposure is terminated after a non-integer number of periods, the actual integrated actual focal position may be significantly “unbalanced,” in comparison to the assumed integrated point spread function. In contrast, if the accumulated number of periods is significant, e.g., at least 5 periods or preferably many more, during an image exposure, then, if the exposure is terminated after a non-integer number of periods, the unbalanced contribution of the incomplete period may be relatively insignificant, and the assumed integrated point spread function will operate in a nearly ideal manner.

In some embodiments, collecting a first image during the course of at least one period of the periodically modulated focus position may comprise exposing an image during the course of an integer number of periods. Based on the foregoing discussion, it will be understood that this may be particularly valuable when an EDOF image exposure comprises relatively few periods of a periodic focus modulation (e.g., 5 or fewer periods.) For example, this might occur when an exposure time must be relatively short in order to avoid overexposure, and/or freeze motion, or the like.

In the example shown in the timing diagram 400, the focus position is modulated sinusoidally. In some embodiments, the image integration time includes a focus change over the entirety of the desired focus range (e.g., at least one period of the periodically modulated focus position, as shown in FIG. 4). In some embodiments, it may be desirable to expose an image only during the more linear portions of the sinusoidal modulation. This allows for more balanced exposure times for each height within the focus position modulation (e.g., the relatively longer focus position dwell times at the extremes of a sinusoidal focus modulation may be eliminated.) Thus, in some embodiments, exposing an image during an image integration time comprises providing illumination having an intensity variation (e.g., an on/off cycle or a more gradual intensity variation) synchronized with the periodically modulated focus position, such that it differently influences the respective exposure contributions for different respective focus positions within the range of the periodically modulated focus position. It will be appreciated that a frame exposure may receive substantially no image contribution when the strobe illumination is off. The timing diagram 400 indicates two exemplary integration periods IPA and IPB, which may be used for exposing an image. The exemplary integration periods IPA and IPB exclude the regions near the extrema of the sinusoidal modulation, i.e., both are at least 15 percent of the period length away from extrema portions of the sinusoidal modulation. The integration periods IPA and IPB may be controlled by providing a corresponding strobe illumination during a frame exposure, according to known methods.

FIG. 5 shows a schematic diagram of a second embodiment of an EDOF imaging system 500 that may be adapted to a machine vision inspection system and operated according to the principles disclosed herein. The imaging system 500 is similar to the imaging system 300 of FIG. 3. Similarly numbered elements marked 3XX in FIGS. 3 and 5XX in FIG. 5 may be understood to be similar or identical and only significant differences will be described with respect to FIG. 5. The embodiment of an EDOF imaging system shown in FIG. 5 is usable when an EDOF imaging system is configured to perform passive optical deconvolution of preliminary image light in an EDOF imaging system and output a relatively clear EDOF image to a camera and/or detector of the imaging system in real time. In the embodiment shown in FIG. 5, the imaging system 500 additionally comprises a first filtering lens 553, a second filtering lens 554 and an optical deconvolution filter 556. The first filtering lens 553 and the second filtering lens 554 provide a 4 f optical relay with the optical deconvolution filter 556 placed at a Fourier plane. The optical deconvolution filter 556 may be derived from an integrated point spread function determined for the imaging system 500, as described in greater detail below with reference to FIG. 6. In operation, the optical deconvolution filter 556 is configured to input preliminary image light from a variable focal length lens 570 and process that image light by optically filtering it, which provides an output EDOF image to a camera 560, which is a relatively clear EDOF image output to the camera 560 in real time.

FIG. 6A is a graph 600A characterizing a first exemplary optical filter which may be used at a Fourier plane of an EDOF imaging system (e.g., as an embodiment of the optical deconvolution filter 556 of FIG. 5) in order to perform optical deconvolution of an image from an EDOF imaging system and provide a relatively clear EDOF image in real time. The graph shows an optical transmission curve 610A. The optical transmission curve 610A comprises a linear optical transmission profile that is, at a minimum, at the center of the optical filter. At the periphery of the optical filter near the edge of a pupil diameter, the optical transmission value is at 100 percent. Beyond the pupil diameter, the optical transmission is at zero. The optical filter characterized by the graph 600A acts as a high pass spatial filter in the process of deconvolution.

FIG. 6B is a graph 600B characterizing a second exemplary optical filter that may be used at a Fourier plane of an EDOF imaging system (e.g., as an embodiment of the optical deconvolution filter 556 of FIG. 5) in order to perform optical deconvolution of an image from an EDOF imaging system and provide a relatively clear EDOF image in real time. The graph shows an optical transmission curve 610B. The optical transmission curve 610B comprises a quadratic optical transmission profile that is, at a minimum, at the center of the optical filter. At the periphery of the optical filter near the edge of a pupil diameter, the optical transmission value is at 100 percent. Beyond the pupil diameter, the optical transmission is at zero. The optical filter characterized by the graph 600B also acts as a high pass spatial filter in the process of deconvolution. It should be appreciated that the optical filters characterized by the graph 600A and the graph 600B are exemplary and not limiting, and optical filters with other transmission profiles may be used, e.g., phase-modifying filters.

FIG. 7 is a flow diagram 700 showing one embodiment of a method for operating an imaging system and associated signal processing of a machine vision inspection system in order to perform computational deconvolution of a preliminary image from an EDOF imaging system and provide a relatively clear EDOF image approximately in real time.

At a block 710, a workpiece is placed in a field of view of the machine vision inspection system.

At a block 720, a focus position of the imaging system is periodically modulated over a plurality of focus positions along a focus axis direction without macroscopically adjusting the spacing between elements in the imaging system. The focus position is periodically modulated in a focus range including a surface height of the workpiece at a frequency of at least 300 Hz (or a much higher frequency, in some embodiments).

At a block 730, a first preliminary image is exposed during an image integration time while modulating the focus position in the focus range.

At a block 740, data from the first preliminary image is processed to remove blurred image contributions occurring in the focus range during the image integration time to provide an image that is substantially focused throughout a larger depth of field than the imaging system provides at a single focal position.

It may be thought that when using a very high speed periodically modulated variable focus lens, such as a TAG lens, that the focus position changes so quickly that the only way it may be used to acquire an EDOF image is to continuously expose the EDOF image in the focus range of the high speed variable focus lens, for example, as in some examples outlined above. However this method of EDOF image exposure has certain disadvantages in various implementations. For example, one drawback with the method when using a periodically modulated variable focus lens, is that the focus position changes sinusoidally, and not at a constant rate. This means a continuous (including partially continuous) EDOF image exposure is not uniform throughout the focus range, which is detrimental in a number of implementations. An alternative method of acquiring an EDOF image using such a lens, which may be more desirable in certain implementations, is described below. The alternative method includes using a plurality of discrete image exposure increments to acquire a preliminary EDOF image in a focus range, according to principles described below. Such a method may be a more adaptable, accurate, and/or robust method in various implementations. It should be appreciated that the focus position may change so quickly when using a very high speed periodically modulated variable focus lens (e.g., a TAG lens), that significant timing, control, and “exposure amount” problems may arise in practical systems. In order to provide a practical solution to such problems, the discrete image exposure increments that are used as constituents of an EDOF image exposure are acquired over a plurality of periodic focus modulations, according to principles disclosed below.

FIGS. 8A-8C show exemplary timing diagrams 800A-800C, respectively, illustrating various aspects of three different image exposure implementations suitable for an EDOF imaging system (e.g., the imaging system 300). The timing diagrams 800A-800C are somewhat analogous to the timing diagram 400, in that an EDOF image exposure may be acquired during a periodic modulation of the focal height or focal position of a variable focus imaging system over its focus range. However, in contrast with the implementation illustrated in the timing diagram 400, which may use a continuous image exposure, in the implementations shown in timing diagrams 800A-800C, an EDOF imaging system is configured to expose a preliminary image using an image exposure comprising a plurality of discrete image exposure increments, according to principles described below.

In particular, the timing diagram 800A shows the periodically modulated focus position MFP of a variable focus imaging system, which is periodically modulated (as shown along the time axis) over a plurality of focus positions along a focus axis direction (as shown along the focal plane Z position axis), over a focus range FR which is assumed to include the distance(s) to the surface of a workpiece to be imaged by the variable focus imaging system. The variable focus imaging system is capable of being operated at a very high focus modulation frequency (e.g., at least 3 kHz, or 30 kHz, or more, in various implementations). As shown in the diagram 800A, a preliminary image is exposed using an image exposure comprising a plurality of discrete image exposure increments EI acquired at respective focus positions FP (e.g., a respective one of the focus positions Z1-Z8) during a camera image integration time comprising a plurality of periods of the periodically modulated focus position MFP. Note: The reference abbreviations EI and/or FP (and/or CT, for controlled timing, used below and shown in FIG. 9) may include an index numeral “i”, which designates a particular “ith” exposure increment EI, or focus position FP, or controlled timing CT. In the case of the exposure increment EI, the index numeral “i” generally ranges from 1 to up to the number of discrete image exposure increments included in the preliminary image exposure (e.g., EI₁-EI₁₆, in the example illustrated in FIG. 8A.)

The plurality of discrete image exposure increments EI are each determined by a respective instance of an illumination source strobe operation or a camera shutter strobe operation, that has a respective controlled timing that defines the discrete focus position FP of the corresponding discrete image exposure increment EI. It will be appreciated that a variable focus imaging system having a periodically modulated focus position has a particular focus position at a particular timing or phase within each period of the modulation. The instantaneous phase of the periodic modulation may be known based on either the drive signal of the variable focus lens, or by monitoring the focus position directly, or the like. Therefore, knowing a calibration relationship between the focus position and the phase of the periodic modulation, a strobe element (e.g., strobe illumination source, or a fast electronic camera shutter) can be controlled to briefly enable an exposure at a particular phase timing in order to acquire an exposure increment at a desired corresponding focus position. This principle may be understood in greater detail with reference to the U.S. Pat. Nos. 8,194,307 and 9,143,674, for example, which are hereby incorporated herein by reference in their entirety. Various aspects of using a controlled timing, as outlined above, are described in greater detail below with reference to FIG. 9.

As shown in FIG. 800A, the respective controlled timings (e.g., as represented by their respective increment times T1-T16) are distributed over a plurality of periods of the periodically modulated focus position MFP, and are configured to provide a set of discrete focus positions FP, which are approximately evenly spaced along the focus axis direction (as represented by their focus position values Z1-Z8.) It has been determined that evenly spaced and/or “weighted” exposure contributions to a “raw” or preliminary EDOF image may be advantageous in terms of signal processing and/or computational operations that may be subsequently performed to enhance the EDOF image. For example, such exposure contributions may be advantageous when providing an enhanced EDOF image by performing deconvolution operations on the preliminary EDOF image, by using a blur kernel that characterizes variable focus imaging system throughout its focus range. Such deconvolution operations are described, for example, in Publication No. WO2009120718 A1, which is hereby incorporated herein by reference in its entirety. However, known methods of providing evenly spaced and/or weighted exposure contributions throughout a focus range for an EDOF image are not sufficiently fast, accurate (in terms of EDOF image clarity and quality), or repeatable.

As previously outlined, the focus position may change so quickly when using a very high speed periodically modulated variable focus lens (e.g., a TAG lens), that significant timing, control, and “exposure amount” problems may arise in practical systems. In particular, during any particular modulation the imaging system focus position may sequentially pass through adjacent pairs of desired focus positions within a period of tens of nanoseconds, rendering discrete exposures at such sequential adjacent focus positions, impractical and/or inaccurate. In order to provide a practical solution to such problems, the respective controlled timings used to acquire the discrete image exposure increments EI at the desired evenly spaced focus positions FP (e.g., Z1-Z8) are configured so that for a plurality of adjacent pairs of discrete focus positions in the set (e.g., the set Z1-Z8), when a first controlled timing provides a first discrete focus position set of the adjacent pair, a second controlled timing that provides a second discrete focus position of the adjacent pair is controlled to have a delay relative to the first controlled timing such that the second controlled timing is controlled to occur after N reversals of the direction of the focus position change during its periodic modulation following the first controlled timing, where N is at least 1. Such direction reversals occur at the limits of the focus range FR, that is, at the extrema of the sinusoidally modulated focus position MFP. In various implementations, this principle is followed for all of the adjacent pairs of discrete focus positions in the set. Such a timing configuration makes it practical to acquire discrete image exposure increments at closely spaced focus positions, in a practical, economical, and versatile manner, with good accuracy.

To clarify the operation with respect to diagram 800A, during the periodically modulated focus position MFP, the camera image integration time starts in the discrete image exposure increment EI₁ is acquired at the increment time T1, which has a phase timing tz1 that corresponds to the desired focus position FP=Z1. The periodically modulated focus position MFP then continues through adjacent focus position Z2, and positions Z3 and Z4, in this example, wherein it is assumed that it is not practical to complete the operations necessary to obtain the next discrete image exposure increment before the focus position reaches Z4. In contrast, the next practical time (that is, after sufficient elapsed time) to obtain a discrete image exposure increment is at the time T2, when the focus position reaches Z5. The discrete image exposure increment EI2 is acquired at the increment time T2, which has a phase timing tz5 that corresponds to the desired focus position FP=Z5. The next practical time (that is, after sufficient elapsed time) to obtain a discrete image exposure increment is at the time T3. The discrete image exposure increment EI3 is acquired at the increment time T3, which has a phase timing tz8 that corresponds to the desired focus position FP=Z8. The acquisition of discrete image exposure increments EI continues in an analogous fashion through the acquisition of the discrete image exposure increment EI8, acquired at the increment time T8, which has a phase timing tz4 that corresponds to the desired focus position FP=Z4. Up to this point, discrete image exposure increments EI₁-EI₈ have been acquired at each of the desired evenly spaced focus positions Z1-Z8 (designated as a subset 810A′), during the image integration time. In some implementations, the image integration time could be terminated at this point. However in the example illustrated in the diagram 800A, the brightness and/or “image signal” of the preliminary EDOF image exposure is strengthened by repeating the previous acquisition pattern to obtain the discrete image exposure increments EI₉-EI₁₆ at the times T9-T16, corresponding to each of the desired evenly spaced focus positions Z1-Z8 (designated as a subset 810A″). The image integration time is then terminated. It will be appreciated that this maintains even “image weighting” for each of the focus positions Z1-Z8 in the overall preliminary EDOF image exposure, which comprises the set 810A of discrete image exposure increments and/or evenly spaced focus positions.

The first preliminary EDOF image (e.g., its image data, as provided by a digital camera or the like), exposed as outlined above, may be processed to remove blurred image contributions occurring in the focus range during the image integration time to provide an extended depth of field (EDOF) image that is substantially focused throughout a larger depth of field than the imaging system provides at a single focal position. For example, in one implementation, processing the preliminary EDOF image to remove blurred image contributions may comprises deconvolution processing of its image data using a predetermined function that characterizes the imaging system (e.g., an integrated point spread function that characterizes the imaging system over a focus range corresponding to the evenly spaced focus positions), to provide a clearer EDOF image.

In the diagram 800A, each discrete image exposure increment EI is acquired when the focus position is changing in the same direction. In some implementations more accurately spaced and/or repeatable focus positions are provided (in comparison to acquiring exposure increments during both directions of focus position change, as described below with reference to FIG. 8C). It may be noted that in this case, when a first controlled timing provides a first discrete focus position set of an adjacent pair (e.g., EI₁ at Z1), a second controlled timing that provides a second discrete focus position of the adjacent pair (e.g., EI₄ at Z2) is controlled to have a delay relative to the first controlled timing such that the second controlled timing is controlled to occur after N reversals of the direction of the focus position, where N is at least 2.

The timing diagram 800B is similar to the timing diagram 800A, and may generally be understood by analogy, except as otherwise indicated below. In the diagram 800B, the plurality of discrete image exposure increments EI₁-EI₈ are each determined by a respective instance of an illumination source strobe operation or a camera shutter strobe operation that has a respective controlled timing that defines its discrete focus position FP (e.g., one of the evenly spaced focus positions Z1-Z8.) The respective controlled timings (e.g., as represented by their respective increment times T1-T8) are distributed over a plurality of periods of the periodically modulated focus position MFP, within the image integration time.

To clarify the operation with respect to diagram 800B, during the periodically modulated focus position MFP, the camera image integration time starts in the discrete image exposure increment EI₁ that is acquired at the increment time T1, which has a phase timing tz1 that corresponds to the desired focus position FP=Z1. The periodically modulated focus position MFP then continues through two reversals of the direction of the focus position change during its periodic modulation following the increment time T1. Even when the periodic modulation has a very high frequency, it is then practical to obtain a discrete image exposure increment EI₂ at the time T2, which has a phase timing tz2 that corresponds to the desired focus position FP=Z2, which is adjacent to Z1. The acquisition of discrete image exposure increments EI continues in an analogous fashion through the acquisition of the discrete image exposure increment EI8, acquired at the increment time T8, which has a phase timing tz8 that corresponds to the desired focus position FP=Z8. At this point, discrete image exposure increments EI₁-EI₈ have been acquired at each of the desired evenly spaced focus positions Z1-Z8 (forming a 810B), during the image integration time. In this example, the image integration time is terminated at this point. It will be appreciated that this maintains even “image weighting” for each of the focus positions Z1-Z8 in the overall preliminary EDOF image exposure, which comprises the set 810B of discrete image exposure increments and/or evenly spaced focus positions.

The timing diagram 800C is similar to the timing diagram 800A, and may generally be understood by analogy, except as otherwise indicated below. In the diagram 800C, the plurality of discrete image exposure increments EI₁-EI₁₆ are each determined by a respective instance of an illumination source strobe operation or a camera shutter strobe operation that has a respective controlled timing that defines its discrete focus position FP (e.g., one of the evenly spaced focus positions Z1-Z8.) The respective controlled timings (e.g., as represented by their respective increment times T1(=tz1), T2(=tz4), T3(=tz8), T4(=tz7), and so on, are distributed over a plurality of periods of the periodically modulated focus position MFP, within the image integration time.

To clarify the operation with respect to diagram 800C, the discrete image exposure increment EI₁ is acquired at the increment time T1, which has a phase timing tz1 that corresponds to the desired focus position FP=Z1. The periodically modulated focus position MFP then continues through adjacent focus position Z2, and position Z3 in this example, wherein it is assumed that it is not practical to complete the operations necessary to obtain the next discrete image exposure increment before the focus position reaches Z3. In contrast, the next practical time (that is, after sufficient elapsed time) to obtain a discrete image exposure increment is at the time T2, when the focus position reaches Z4. The discrete image exposure increment EI2 is acquired at the increment time T2, which has a phase timing tz4 that corresponds to the desired focus position FP=Z4. The next practical time (that is, after sufficient elapsed time) to obtain a discrete image exposure increment is at the time T3. The discrete image exposure increment EI3 is acquired at the increment time T3, which has a phase timing tz8 that corresponds to the desired focus position FP=Z8. The focus position change slows as it reverses direction after the time T3(=tz8), such that the next practical time to obtain a discrete image exposure increment is at the time T4 which has a phase timing tz7 that corresponds to the desired focus position FP=Z7. It may be noted that this focus position is adjacent to the focus position Z8 of the previously acquired discrete image exposure increment, after just one reversal (N=1) of the direction of focus change. It may be noted that N=1, because in this example discrete image exposure increments are acquired during both directions of focus change. More generally, it may be noted that in this example when a first controlled timing provides a first discrete focus position set of an adjacent pair, a second controlled timing that provides a second discrete focus position of the adjacent pair may occur after various numbers of reversals of the direction of the focus position (N ranges from 1 to 4, for various adjacent pairs, in this example.)

In the example illustrated in the diagram 800C, the brightness and/or “image signal” of the preliminary EDOF image exposure is strengthened by repeating the discrete image exposure increments at each focus position (but in a different order the second time). The discrete image exposure increments EI₁-EI₈ obtained at the times T1-T8 (designated in a subset 810C′ in FIG. 8C), correspond to each of the desired evenly spaced focus positions Z1-Z8. The discrete image exposure increments EI₉-EI₁₆ at the times T9-T16 (designated in a subset 810C″ in FIG. 8C) provide a repeated discrete image exposure increment corresponding to each of the desired evenly spaced focus positions Z1-Z8. Together, the subsets 810C′ and 810C″ contribute to the overall preliminary EDOF image exposure, which comprises the set 810C of discrete image exposure increments and/or evenly spaced focus positions. The pattern or repetition illustrated here (and in the diagram 800A) is not limiting. More generally, in various embodiments, repeating the discrete image exposure increments at each focus position may be configured wherein a plurality of discrete image exposure increments used for a preliminary EDOF image comprise at least a first instance and a second instance of a discrete image exposure increment acquired at each discrete focus position (e.g., each of at least 20 approximately equally spaced focus positions, in some implementations), during the image integration time. The respective controlled timings used for acquiring the first and second instances of a discrete image exposure increment at the same discrete focus position may be configured such that a controlled timing used for the second instance has a delay relative to a controlled timing used for the first instance, and is controlled to occur after M reversals of the direction of change of the focus position during its periodic modulation following the controlled timing used for the first instance, where M is at least 1.

It will be appreciated that the foregoing timing diagram examples are exemplary only and not limiting. Other timing configurations and combinations may be realized based on principles illustrated and described above. In some implementations, the focus range may span at least 10 times the depth of field than the imaging system in a single focal position and the respective controlled timings are configured to provide a set of at least 20 approximately equally spaced discrete focus positions (e.g. Z1-Z20) during the image integration time. In some implementations, the at least 20 discrete focus positions may distributed over at least 50% of the focus range, to provide a relatively large extended depth field. In some implementations, the at least 20 discrete focus positions may distributed over at least 70% or even 80% of the focus range.

In some implementations, many more discrete image exposure increments may be provided during a single period of the periodically modulated focus position. However, in other implementations, and particularly those with high frequency periodic modulations of the focus position, at most 6 discrete image exposure increments might be provided during a single period of the periodically modulated focus position.

In some implementations, the operations outlined above with respect to any of diagrams 800A-800C, or a combination thereof, may be to provide a plurality of EDOF images that are substantially focused throughout a larger depth of field than the imaging system provides at a single focal position, and the plurality of EDOF images may be displayed in a live video display window that is provided on a display included in a machine vision inspection system.

In various implementations, it is currently more practical to provide discrete image exposure increments using an illumination source strobe operation that has a respective controlled timing that defines the discrete focus position of its corresponding discrete image exposure increment. However, digital cameras having an electronic “shutter strobe” function that can create timed sub-exposure increments within an overall image integration period are increasingly available. Such cameras may provide the controlled timings outlined above, using continuous or ambient illumination, in some implementations.

In some implementations, an illumination source strobe operation may be used in combination with an illumination source that includes multiple color sources. In such a case, axial chromatic aberration in the imaging system may cause the various color sources to focus at different focus positions. In such a case it should be appreciated that a respective controlled timing outlined above may comprise a different color source timing for each color source, including a timing offset between the color source timings that compensates for axial chromatic aberration in the imaging system, so that each of the color sources provides the same discrete focus position.

It will be understood that the operations described above with reference to the timing diagrams 800A-800C may be implemented in a correspondingly configured EDOF imaging system which is similar to one of the imaging systems depicted in any of the FIG. 2, 3, or 5, for example, to provide an image of a workpiece that has a larger depth of field than the imaging system provides at a single focal position.

FIG. 9 shows a timing diagram 900 which shows certain details of one exemplary implementation of a controlled timing CT that may be used to define a discrete focus position FP and certain other characteristics to determine a corresponding discrete image exposure increment EI. In particular, the control timing may be implemented in an illumination source strobe operation or camera shutter strobe operation to determine the focus position FP and certain other characteristics of a corresponding discrete image exposure increment EI. The timing diagram 900 may be understood as a more detailed view of a portion of the timing diagram 800A, showing two representative discrete image exposure increments EI₁ and EI₂, and may generally be understood by analogy thereto. However, additional principles related to one exemplary implementation of a controlled timing CT are described.

In the implementation shown FIG. 9, each controlled timing CTi comprises a respective increment time Ti and a respective increment duration Di, and a respective increment illumination intensity Li is used during the respective increment duration Di. In particular, the illustrated controlled timing CT1 that determines the exposure increment EI₁ comprises an increment time T1 (as previously described with reference to FIGS. 8A-8C) and a respective increment duration D1 (e.g., a timed strobe duration). The illustrated controlled timing CT2 that determines the exposure increment EI₂ similarly comprises a respective increment time T2 and an increment duration D2. It may be seen that each increment duration is located to provide a central or average increment time that corresponds to a desired focus position. For example, the increment duration D1 is located to provide the increment time T1(=tz1) corresponding to the desired focus position FP₁(=Z1), and the increment duration D2 is located to provide the increment time T2(=tz5) corresponding to the desired focus position FP₂(=Z5). In various implementations, a respective increment illumination intensity Li is used during a respective increment duration Di, and each discrete image exposure increment is exposed using a combination of its respective increment illumination intensity Li and its respective increment duration Di such that the product (Li*Di) is approximately the same for each of the discrete image exposure increments. Although this aspect of the implementation is not strictly required, it tends to provide equal “weighting” in a preliminary EDOF image, at each of the desired focus positions, which may be advantageous in some implementations.

The implementation shown in FIG. 9 also includes an aspect wherein a discrete image exposure increment (EI₂) corresponding to a focus position (FP2) that is relatively closer to the middle of the focus range FR, comprises a combination of in increment duration D2 which is relatively shorter and an increment illumination intensity (e.g., L2, not shown) which is relatively larger, and a discrete image exposure increment (EI₁) corresponding to a focus position (FP1) that is relatively farther from the middle of the focus range FR comprises a combination of a second increment duration D1 which is relatively longer, and a second increment illumination intensity (e.g., L1, not shown) which is relatively smaller. In various implementations wherein the periodically modulated focus position changes approximately sinusoidally as a function of time, this allows the product (Li*Di) to be approximately the same for each of the discrete image exposure increments while at the same time allowing each respective increment duration to be controlled to provide approximately the same amount of focus position change ΔFP during each increment duration. For example, it may be seen that this allows ΔFP1=ΔFP2 in FIG. 9, even though the rate of focus change is different for each exposure increment due to the sinusoidal focus modulation. Although this aspect of the implementation is also not strictly required, it tends to provide another aspect of equal “weighting” in a preliminary EDOF image, at each of the desired focus positions, which may be advantageous in some implementations.

FIG. 10 is a flow diagram 1000 showing one embodiment of a method for operating an imaging system of a machine vision inspection system in order to provide at least one EDOF image that has a larger depth of field than the imaging system in a single focal position. The method includes exposing a preliminary EDOF image using an image exposure comprising a plurality of discrete image exposure increments, according to principles disclosed herein.

At a block 1010, a workpiece is placed in a field of view of the machine vision inspection system.

At a block 1020, a focus position of the imaging system is periodically modulated without macroscopically adjusting the spacing between elements in the imaging system, wherein the focus position is periodically modulated over a plurality of focus positions along a focus axis direction in a focus range including a surface height of the workpiece, at a modulation frequency of at least 3 kHz.

At a block 1030, a first preliminary image is exposed using an image exposure comprising a plurality of discrete image exposure increments acquired at respective discrete focus positions during an image integration time comprising a plurality of periods of the periodically modulated focus position, wherein:

-   -   the plurality of discrete image exposure increments are each         determined by a respective instance of an illumination source         strobe operation, or a camera shutter strobe operation, that has         a respective controlled timing that defines the discrete focus         position of the corresponding discrete image exposure increment;     -   the respective controlled timings are distributed over the         plurality of periods of the periodically modulated focus         position, and are configured to provide a set of discrete focus         positions which are approximately evenly spaced along the focus         axis direction; and     -   the respective controlled timings are furthermore configured so         that for a plurality of adjacent pairs of discrete focus         positions in the set, when a first controlled timing provides a         first discrete focus position set of the adjacent pair, a second         controlled timing that provides a second discrete focus position         of the adjacent pair is controlled to have a delay relative to         the first controlled timing such that the second controlled         timing is controlled to occur after N reversals of the direction         of change of the focus position during its periodic modulation         following the first controlled timing, where N is at least 1.

At a block 1040, the first preliminary image is processed to remove blurred image contributions occurring in the focus range during the image integration time to provide an extended depth of field (EDOF) image that is substantially focused throughout a larger depth of field than the imaging system provides at a single focal position. For example, such processing may include performing deconvolution operations using a blur kernel that characterizes the imaging system throughout its focus range (e.g., and integrated point spread function), as previously discussed herein.

While various embodiments of the invention have been illustrated and described, numerous variations in the illustrated and described arrangements of features and sequences of operations will be apparent to one skilled in the art based on this disclosure. Thus, it will be appreciated that various changes can be made therein without departing from the spirit and scope of the invention. 

The embodiments of the invention in which an exclusive property or privilege is claimed are defined as follows:
 1. A method for operating an imaging system of a machine vision inspection system to provide at least one image that has a larger depth of field than the imaging system in a single focal position, the method comprising: (a) placing a workpiece in a field of view of the machine vision inspection system; (b) periodically modulating a focus position of the imaging system without macroscopically adjusting the spacing between elements in the imaging system, wherein the focus position is periodically modulated over a plurality of focus positions along a focus axis direction in a focus range including a surface height of the workpiece, at a modulation frequency of at least 3 kHz; (c) exposing a first preliminary image using an image exposure comprising a plurality of discrete image exposure increments acquired at respective discrete focus positions during an image integration time comprising a plurality of periods of the periodically modulated focus position, wherein: the plurality of discrete image exposure increments are each determined by a respective instance of an illumination source strobe operation, or a camera shutter strobe operation, that has a respective controlled timing that defines the discrete focus position of the corresponding discrete image exposure increment; the respective controlled timings are distributed over the plurality of periods of the periodically modulated focus position, and are configured to provide a set of discrete focus positions which are approximately evenly spaced along the focus axis direction; and the respective controlled timings are furthermore configured so that for a plurality of adjacent pairs of discrete focus positions in the set, when a first controlled timing provides a first discrete focus position set of the adjacent pair, a second controlled timing that provides a second discrete focus position of the adjacent pair is controlled to have a delay relative to the first controlled timing such that the second controlled timing is controlled to occur after N reversals of the direction of change of the focus position during its periodic modulation following the first controlled timing, where N is at least 1; and (d) processing the first preliminary image to remove blurred image contributions occurring in the focus range during the image integration time to provide an extended depth of field (EDOF) image that is substantially focused throughout a larger depth of field than the imaging system provides at a single focal position.
 2. The method of claim 1, wherein in step (c) each discrete image exposure increment is determined by a respective instance of the illumination source strobe operation.
 3. The method of claim 1, wherein the periodically modulated focus position changes approximately sinusoidally as a function of time.
 4. The method of claim 1, wherein each “ith” respective controlled timing comprises a respective increment time Ti and a respective increment duration Di, and a respective increment illumination intensity Li is used during the respective increment duration Di, and each discrete image exposure increment of the first preliminary image is exposed using a combination of its respective increment illumination intensity Li and its respective increment duration Di such that the product (Li*Di) is approximately the same for each of the discrete image exposure increments.
 5. The method of claim 4, wherein a discrete image exposure increment corresponding to a first focus position that is relatively closer to the middle of the focus range comprises a combination of a first increment duration Di which is relatively shorter and a first increment illumination intensity Li which is relatively larger, and a discrete image exposure increment corresponding to a second focus position that is relatively farther from the middle of the focus range comprises a combination of a second increment duration Di which is relatively longer and a second increment illumination intensity Li which is relatively smaller.
 6. The method of claim 5, wherein the periodically modulated focus position changes approximately sinusoidally as a function of time and the first increment duration and the second increment duration are controlled to provide approximately the same amount of focus position change during the first increment duration and the second increment duration.
 7. The method of claim 1, wherein the focus range spans at least 10 times the depth of field than the imaging system in a single focal position and the respective controlled timings are configured to provide a set of at least 20 discrete focus positions during the image integration time.
 8. The method of claim 7, wherein: the imaging system comprises a tunable acoustic gradient index of refraction (TAG) lens configured to periodically modulate the focus position of the imaging system without macroscopically adjusting the spacing between elements in the imaging system; the modulation frequency is at least 30 kHz; and at most 6 discrete image exposure increments are provided during a single period of the periodically modulated focus position.
 9. The method of claim 7, wherein the at least 20 discrete focus positions are distributed over at least 50% of the focus range.
 10. The method of claim 7, wherein: the first plurality of discrete image exposure increments used for the first preliminary image comprise at least a first instance and a second instance of a discrete image exposure increment acquired at each of the at least 20 discrete focus positions, during the image integration time, and the respective controlled timings used for acquiring the first and second instances of a discrete image exposure increment at the same discrete focus position are configured such that a controlled timing used for the second instance has a delay relative to a controlled timing used for the first instance, and is controlled to occur after M reversals of the direction of change of the focus position during its periodic modulation following the controlled timing used for the first instance, where M is at least
 1. 11. The method of claim 1, wherein processing the first preliminary image to remove blurred image contributions comprises deconvolution processing of image data corresponding to the first preliminary image using a predetermined function that characterizes the imaging system, to provide the EDOF image.
 12. The method of claim 1, wherein: the imaging system comprises a variable focal length lens, and periodically modulating a focus position of the imaging system comprises modulating a focus position of the variable focal length lens, and the imaging system further comprises an optical filter located to receive and spatially filter preliminary image light from the variable focal length lens; and in step (d), processing the first preliminary image to remove blurred image contributions comprises spatially filtering the preliminary image light using the optical filter, to provide the EDOF image based on light output by the optical filter.
 13. The method of claim 1, further comprising: repeating steps (c) and (d) to provide a plurality of EDOF images that are substantially focused throughout a larger depth of field than the imaging system provides at a single focal position, and displaying the plurality of EDOF images of the workpiece in a live video display window that is provided on a display included in the machine vision inspection system.
 14. The method of claim 1, wherein the illumination source includes multiple color sources, and the respective controlled timing comprises a different color source timing for each color sources, including a timing offset between the color source timings that compensates for axial chromatic aberration in the imaging system so that each of the color sources provides the same discrete focus position.
 15. An imaging system for providing at least one image of a workpiece that has a larger depth of field than the imaging system provides at a single focal position, the imaging system comprising: an objective lens, a variable focal length tunable acoustic gradient index of refraction (TAG) lens, and a camera, at least one of a controllable strobe illumination light source or a fast camera shutter operable within the camera during an image integration time; and a control system configured to control the camera, and the strobe illumination light source if present, and to control the TAG lens to periodically modulate the focus position of the imaging system without macroscopically adjusting the spacing between elements in the imaging system, wherein the control system is further configured to: (a) control the TAG lens to periodically modulate the focus position over a plurality of focus positions along a focus axis direction in a focus range including a surface height of the workpiece, at a modulation frequency of at least 30 kHz; (b) operate the imaging system to expose a first preliminary image using an image exposure comprising a plurality of discrete image exposure increments acquired at respective discrete focus positions during an image integration time comprising a plurality of periods of the periodically modulated focus position, wherein: the plurality of discrete image exposure increments are each determined by a respective instance of an illumination source strobe operation, or a camera shutter strobe operation, that has a respective controlled timing that defines the discrete focus position of the corresponding discrete image exposure increment, the respective controlled timings are distributed over the plurality of periods of the periodically modulated focus position, and are configured to provide a set of discrete focus positions which are approximately evenly spaced along the focus axis direction, and the respective controlled timings are furthermore configured so that for a plurality of adjacent pairs of discrete focus positions in the set, when a first controlled timing provides a first discrete focus position set of the adjacent pair, a second controlled timing that provides a second discrete focus position of the adjacent pair is controlled to have a delay relative to the first controlled timing such that the second controlled timing is controlled to occur after N reversals of the direction of change of the focus position during its periodic modulation following the first controlled timing, where N is at least 1; and (c) process the first preliminary image to remove blurred image contributions occurring in the focus range during the image integration time to provide an extended depth of field (EDOF) image that is substantially focused throughout a larger depth of field than the imaging system provides at a single focal position.
 16. The imaging system of claim 15, wherein each “ith” respective controlled timing comprises a respective increment time Ti and a respective increment duration Di, and a respective increment illumination intensity Li is used during the respective increment duration Di, and each discrete image exposure increment of the first preliminary image is exposed using a combination of its respective increment illumination intensity Li and its respective increment duration Di such that the product (Li*Di) is approximately the same for each of the discrete image exposure increments.
 17. The imaging system of claim 16, wherein: a discrete image exposure increment corresponding to a first focus position that relatively closer to the middle of the focus range comprises a combination of a first increment duration Di which is relatively shorter and a first increment illumination intensity Li which is relatively larger, and a discrete image exposure increment corresponding to a second focus position that is relatively farther from the middle of the focus range comprises a combination of a second increment duration Di which is relatively longer and a second increment illumination intensity Li which is relatively smaller; the periodically modulated focus position changes approximately sinusoidally as a function of time; and the first increment duration and the second increment duration are controlled to provide approximately the same amount of focus position change during the first increment duration and the second increment duration.
 18. The imaging system of claim 15, wherein the focus range spans at least 10 times the depth of field of the imaging system in a single focal position and the respective controlled timings are configured to provide a set of at least 20 discrete focus positions during the image integration time.
 19. The imaging system of claim 15, wherein at most 6 discrete image exposure increments are provided during a single period of the periodically modulated focus position.
 20. The imaging system of claim 15, wherein processing the first preliminary image to remove blurred image contributions comprises deconvolution processing of image data corresponding to the first preliminary image using a predetermined function that characterizes the imaging system, to provide the EDOF image. 